/**
 * Description:
 * Class Name:RightTest
 * Date:2022/3/25 15:05
 *
 * @author LTisme
 * @version JAVA17
 */
package 疯狂Java讲义.第9章_泛型._9_4_泛型方法._9_4_1_定义泛型方法;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class RightTest {
    // 声明一个泛型方法，该泛型方法中带一个T泛型形参
    static <T> void test(Collection<? extends T> from, Collection<T> to){
        to.addAll(from);
    }

    public static void main(String[] args) {
        List<Object> as = new ArrayList<>();
        List<String> ao = new ArrayList<>();
        // 下面代码正常
        test(ao, as);
    }
}
